package com.mico.example.springboot.mybatis.multi.controller;




import com.mico.example.springboot.mybatis.multi.domain.primary.User;
import com.mico.example.springboot.mybatis.multi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by micocube
 * ProjectName: springboot-example
 * PackageName: com.mico.example.springboot.jpa.controller
 * User: micocube
 * Email: ldscube@gmail.com
 * CreateTime: 2019/2/25下午1:55
 * ModifyTime: 2019/2/25下午1:55
 * Version: 0.1
 * Description:
 **/
@RestController
public class UserController {
    @Autowired
    UserService userService;
    @GetMapping("/user/{id}")
    public User getUserByName(@PathVariable Integer id){
        User byUsername = userService.findById(id);
        return byUsername;
    }

    @GetMapping("/test/transaction")
    public String transaction(){
        userService.testTransaction();
        return "test";
    }
}
